#include "Entity.h"

Entity::Entity(){
	m_sprite = NULL;
}

Entity::~Entity(){
}

bool Entity::init(){
	bool bRet = false;
	do{

		bRet = true;
	}while(0);

	return bRet;
}

void Entity::bindSprite(CCSprite* sprite){
	if(m_sprite != NULL){
		m_sprite->removeFromParentAndCleanup(true);
	}

	m_sprite = sprite;
	this->addChild(m_sprite);
}

void Entity::bindSprite(CCArmature *armature){
	if(armature != NULL){
		armature->removeFromParentAndCleanup(true);
	}

	m_armature = armature;
	this->addChild(m_armature);
}

CCSprite* Entity::getSprite(){
	return m_sprite;
}

CCRect Entity::boundBox(){
	if(m_sprite == NULL){
		return CCRect(0,0,0,0);
	}

	CCPoint pos = this->getPosition();
	CCSize size = m_sprite->getContentSize();

	return CCRect(pos.x - size.width/2, pos.y - size.height/2, size.width, size.height);
}

CCArmature* Entity::getArmature(){
	return m_armature;
}